(function () {
    var head = document.getElementsByTagName("head")[0];
    if (head) {
        var scriptStyles = document.createElement("link");
        scriptStyles.rel = "stylesheet";
        scriptStyles.type = "text/css";
        scriptStyles.href = baseUrl + "/css/js.css";
        head.appendChild(scriptStyles);
    }
}());

$(function() {

    $('#view-page').click(function() {
        $(this).attr('target', '_blank');
    });

    var $pageProperties = $('#page-properties');
    var $showPagePropertiesLink = $('<a href="#" id="show-page-properties-link">Show page properties</a>')
        .click(function() {
            $(this).remove();
            $pageProperties.children('fieldset').slideDown("slow");
            return false;
        });
    $pageProperties.prepend($showPagePropertiesLink);

    var $addCustomField = $('#add-custom-field');
    var $addCustomFieldLink = $('<a href="#" id="add-custom-field-link">Add custom field</a>')
        .click(function() {
            $(this).remove();
            $addCustomField.children('fieldset').slideDown("normal");
            return false;
        });
    $addCustomField.prepend($addCustomFieldLink);
});